package alo.p19;

/**
 * @ClassName Making
 * @Description 找零问题
 * @Author Fanxc
 * @DATE 2021/3/15 20:44
 * @Version 1.0
 */
public class Making {
    int[] T=new int[1024];
    int[] D=new int[10];
    int making(int n){
        if (n<0){
            return -1;
        }
        if (n==0){
            return 0;
        }
        if (T[n]!=0){
            return T[n];
        }
        int ans=-1;
        for (int j : D) {
            ans = Math.min(ans, making(n - j));
        }
        return T[n]=ans+1;
    }
}
